<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>射击游戏模拟与mincore反外挂演示</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        
        :root {
            --primary: #4a6cfa;
            --secondary: #7e68ff;
            --accent: #ff6b6b;
            --success: #41d695;
            --warning: #ffc107;
            --dark: #2c3e50;
            --light: #f8f9fa;
            --card-bg: #ffffff;
            --header-height: 80px;
            --transition: all 0.3s ease;
        }
        
        body {
            background: linear-gradient(135deg, #1a2530, #1c2a35);
            color: white;
            line-height: 1.7;
            min-height: 100vh;
            overflow-x: hidden;
        }
        
        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 0 20px;
        }
        
        header {
            background: linear-gradient(to right, #2c3e50, #1a2530);
            color: white;
            padding: 1.5rem 0;
            box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
            position: sticky;
            top: 0;
            z-index: 1000;
        }
        
        .header-content {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .logo {
            display: flex;
            align-items: center;
            gap: 15px;
        }
        
        .logo-icon {
            background: var(--primary);
            width: 50px;
            height: 50px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 22px;
            box-shadow: 0 0 20px rgba(74, 108, 250, 0.6);
        }
        
        .logo-text {
            font-size: 1.8rem;
            font-weight: 700;
        }
        
        .main-container {
            display: flex;
            gap: 30px;
            margin: 40px 0;
        }
        
        .left-panel {
            flex: 1;
            min-width: 600px;
            display: flex;
            flex-direction: column;
            gap: 30px;
        }
        
        .right-panel {
            flex: 1;
            min-width: 600px;
        }
        
        .game-panel {
            background: linear-gradient(135deg, #2c3e50, #1a2530);
            border-radius: 16px;
            padding: 30px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
        }
        
        .game-title {
            font-size: 1.8rem;
            margin-bottom: 25px;
            color: var(--primary);
            text-align: center;
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 15px;
        }
        
        .player-stats {
            display: flex;
            flex-direction: column;
            gap: 20px;
            margin-bottom: 30px;
        }
        
        .stat-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 12px;
            transition: var(--transition);
        }
        
        .stat-item:hover {
            background: rgba(74, 108, 250, 0.2);
            transform: translateY(-3px);
        }
        
        .stat-label {
            font-size: 1.2rem;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .stat-value {
            font-size: 1.5rem;
            font-weight: bold;
            color: var(--success);
        }
        
        .game-controls {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 15px;
            margin: 25px 0;
        }
        
        .game-btn {
            padding: 14px;
            border-radius: 12px;
            border: none;
            font-weight: 600;
            cursor: pointer;
            transition: var(--transition);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            font-size: 1rem;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }
        
        .game-btn:hover {
            transform: translateY(-3px);
        }
        
        .damage-btn {
            background: linear-gradient(to right, var(--accent), #ff5252);
            color: white;
        }
        
        .shoot-btn {
            background: linear-gradient(to right, var(--primary), var(--secondary));
            color: white;
        }
        
        .reset-btn {
            background: linear-gradient(to right, var(--warning), #ffb300);
            color: white;
        }
        
        .cheat-panel {
            background: rgba(0, 0, 0, 0.3);
            border-radius: 12px;
            padding: 20px;
            margin: 30px 0;
        }
        
        .cheat-title {
            font-size: 1.3rem;
            margin-bottom: 15px;
            color: var(--accent);
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .input-group {
            margin-bottom: 15px;
        }
        
        .input-group label {
            display: block;
            margin-bottom: 8px;
            font-size: 0.9rem;
            opacity: 0.8;
        }
        
        .input-group input {
            width: 100%;
            padding: 12px 15px;
            border-radius: 8px;
            border: none;
            background: rgba(255, 255, 255, 0.1);
            color: white;
            font-size: 1rem;
        }
        
        .input-group input:focus {
            outline: none;
            background: rgba(255, 255, 255, 0.15);
        }
        
        .cheat-btn {
            width: 100%;
            padding: 14px;
            border-radius: 8px;
            border: none;
            background: linear-gradient(to right, #7e68ff, #6a5acd);
            color: white;
            font-weight: 600;
            cursor: pointer;
            transition: var(--transition);
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 10px;
        }
        
        .cheat-btn:hover {
            background: linear-gradient(to right, #6a5acd, #5d4cbb);
            transform: translateY(-3px);
        }
        
        .detection-panel {
            background: rgba(0, 0, 0, 0.3);
            border-radius: 12px;
            padding: 20px;
            margin-top: 30px;
            border: 1px solid rgba(74, 108, 250, 0.3);
        }
        
        .detection-title {
            font-size: 1.3rem;
            margin-bottom: 15px;
            color: var(--primary);
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .detection-btn {
            width: 100%;
            padding: 14px;
            border-radius: 8px;
            border: none;
            background: linear-gradient(to right, var(--success), #2dcb84);
            color: white;
            font-weight: 600;
            cursor: pointer;
            transition: var(--transition);
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 10px;
        }
        
        .detection-btn:hover {
            background: linear-gradient(to right, #2dcb84, #25b877);
            transform: translateY(-3px);
        }
        
        .result-panel {
            background: rgba(0, 0, 0, 0.4);
            border-radius: 12px;
            padding: 25px;
            margin-top: 20px;
            text-align: center;
            border-left: 5px solid var(--primary);
        }
        
        .result-title {
            font-size: 1.5rem;
            margin-bottom: 15px;
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 10px;
        }
        
        .result-content {
            font-size: 1.2rem;
            line-height: 1.6;
        }
        
        .result-success {
            color: var(--success);
            font-weight: 600;
        }
        
        .result-danger {
            color: var(--accent);
            font-weight: 600;
        }
        
        .memory-panel {
            background: linear-gradient(135deg, #2c3e50, #1a2530);
            border-radius: 16px;
            padding: 30px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
            height: 100%;
            display: flex;
            flex-direction: column;
        }
        
        .memory-title {
            font-size: 1.8rem;
            margin-bottom: 25px;
            color: var(--primary);
            text-align: center;
        }
        
        .memory-visualization {
            flex: 1;
            background: rgba(0, 0, 0, 0.3);
            border-radius: 12px;
            position: relative;
            overflow: hidden;
            margin-bottom: 25px;
        }
        
        .memory-block {
            position: absolute;
            background: rgba(255, 255, 255, 0.1);
            border: 2px solid var(--primary);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            font-weight: bold;
            color: white;
            transition: all 0.5s ease;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
            cursor: pointer;
            overflow: hidden;
            z-index: 2;
            padding: 10px;
            text-align: center;
            font-size: 14px;
        }
        
        .memory-block.normal {
            background: rgba(74, 108, 250, 0.2);
        }
        
        .memory-block.trap {
            background: rgba(74, 108, 250, 0.4);
            border: 2px solid var(--secondary);
            animation: pulse-blue 2s infinite;
        }
        
        .memory-block.accessed {
            background: rgba(255, 107, 107, 0.4);
            border: 2px solid var(--accent);
            animation: pulse-red 1s infinite;
        }
        
        .memory-block.user {
            background: rgba(65, 214, 149, 0.3);
            border: 2px solid var(--success);
        }
        
        .memory-block.health {
            background: rgba(255, 107, 107, 0.3);
            border: 2px solid var(--accent);
        }
        
        .memory-block.ammo {
            background: rgba(255, 193, 7, 0.3);
            border: 2px solid var(--warning);
        }
        
        @keyframes pulse-blue {
            0% { box-shadow: 0 0 0 0 rgba(74, 108, 250, 0.4); }
            70% { box-shadow: 0 0 0 10px rgba(74, 108, 250, 0); }
            100% { box-shadow: 0 0 0 0 rgba(74, 极 108, 250, 0); }
        }
        
        @keyframes pulse-red {
            0% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.4); }
            70% { box-shadow: 0 0 0 10px rgba(255, 107, 107, 0); }
            100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0); }
        }
        
        .memory-info {
            background: rgba(0, 0, 0, 0.3);
            border-radius: 12px;
            padding: 20px;
            margin-top: 20px;
        }
        
        .info-title {
            font-size: 1.2rem;
            margin-bottom: 15px;
            color: var(--primary);
        }
        
        .info-content {
            line-height: 1.6;
            opacity: 0.9;
        }
        
        .info-list {
            margin-left: 20px;
            margin-top: 10px;
        }
        
        .info-list li {
            margin-bottom: 10px;
        }
        
        .memory-legend {
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            margin-top: 20px;
            justify-content: center;
        }
        
        .legend-item {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 0.9rem;
        }
        
        .legend-color {
            width: 20px;
            height: 20px;
            border-radius: 4px;
        }
        
        .legend-health {
            background: rgba(255, 107, 107, 0.3);
            border: 1px solid var(--accent);
        }
        
        .legend-ammo {
            background: rgba(255, 193, 7, 0.3);
            border: 1px solid var(--warning);
        }
        
        .legend-trap {
            background: rgba(74, 108, 250, 0.4);
            border: 1px solid var(--secondary);
        }
        
        .legend-normal {
            background: rgba(74, 108, 250, 0.2);
            border: 1px solid var(--primary);
        }
        
        .legend-user {
            background: rgba(65, 214, 149, 0.3);
            border: 1px solid var(--success);
        }
        
        .legend-accessed {
            background: rgba(255, 107, 107, 0.4);
            border: 1px solid var(--accent);
        }
        
        footer {
            background: rgba(0, 0, 0, 0.5);
            color: white;
            padding: 30px 0;
            text-align: center;
            margin-top: 50px;
        }
        
        .footer-content {
            max-width: 800px;
            margin: 0 auto;
        }
        
        .social-icons {
            display: flex;
            justify-content: center;
            gap: 25px;
            margin: 30px 0;
        }
        
        .social-icon {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.1);
            color: white;
            font-size: 1.4rem;
            transition: var(--transition);
        }
        
        .social-icon:hover {
            background: var(--primary);
            transform: translateY(-5px);
        }
        
        /* Responsive Design */
        @media (max-width: 1200px) {
            .main-container {
                flex-direction: column;
            }
            
            .left-panel, .right-panel {
                min-width: 100%;
            }
        }
    </style>
</head>
<body>
    <header>
        <div class="container">
            <div class="header-content">
                <div class="logo">
                    <div class="logo-icon">
                        <i class="fas fa-gamepad"></i>
                    </div>
                    <div class="logo-text">射击游戏模拟与反外挂演示</div>
                </div>
            </div>
        </div>
    </header>
    
    <div class="container">
        <div class="main-container">
            <div class="left-panel">
                <div class="game-panel">
                    <h2 class="game-title"><i class="fas fa-crosshairs"></i> 射击游戏模拟</h2>
                    
                    <div class="player-stats">
                        <div class="stat-item">
                            <div class="stat-label">
                                <i class="fas fa-heart"></i>
                                <span>玩家血量</span>
                            </div>
                            <div class="stat-value" id="health-value">100</div>
                        </div>
                        
                        <div class="stat极-item">
                            <div class="stat-label">
                                <i class="fas fa-bullseye"></i>
                                <span>子弹数量</span>
                            </div>
                            <div class="stat-value" id="ammo-value">30</div>
                        </div>
                    </div>
                    
                    <div class="game-controls">
                        <button id="damage-btn" class="game-btn damage-btn">
                            <i class="fas fa-heart-broken"></i> 受到伤害
                        </button>
                        <button id="shoot-btn" class="game-btn shoot-btn">
                            <i class="fas fa-fire"></i> 射击
                        </button>
                        <button id="reset-btn" class="game-btn reset-btn">
                            <i class="fas fa-redo"></i> 重置游戏
                        </button>
                    </div>
                    
                    <div class="cheat-panel">
                        <h3 class="cheat-title"><i class="fas fa-user-secret"></i> 外挂修改器</h3>
                        
                        <div class="input-group">
                            <label>搜索数值（血量或子弹）</label>
                            <input type="number" id="search-value" placeholder="输入要搜索的数值">
                        </div>
                        
                        <button id="search-btn" class="cheat-btn">
                            <i class="fas fa-search"></i> 搜索数值
                        </button>
                        
                        <div class="input-group" style="margin-top: 20px;">
                            <label>修改数值</label>
                            <input type="number" id="modify-value" placeholder="输入新的数值">
                        </div>
                        
                        <button id="modify-btn" class="cheat-btn">
                            <i class="fas fa-edit"></i> 修改数值
                        </button>
                        
                        <div id="search-result" style="margin-top: 15px; padding: 10px; background: rgba(255,255,255,0.1); border-radius: 8px; display: none;">
                            <p>已找到 <span id="found-value">0</span> 个匹配项</p>
                        </div>
                    </div>
                </div>
                
                <div class="detection-panel">
                    <h3 class="detection-title"><i class="fas fa-shield-alt"></i> mincore反外挂检测</h3>
                    <button id="detect-btn" class="detection-btn">
                        <i class="fas fa-radar"></i> 运行内存检测
                    </button>
                    
                    <div class="result-panel" id="result-panel">
                        <div class="result-title">
                            <i class="fas fa-info-circle"></i>
                            <span>检测结果</span>
                        </div>
                        <div class="result-content">
                            点击"运行内存检测"按钮检查是否有外挂行为
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="right-panel">
                <div class="memory-panel">
                    <h2 class="memory-title"><i class="fas fa-memory"></i> 内存状态可视化</h2>
                    
                    <div class="memory-visualization" id="memory-visualization">
                        <!-- Memory visualization will be generated by JS -->
                    </div>
                    
                    <div class="memory-legend">
                        <div class="legend-item">
                            <div class="legend-color legend-health"></div>
                            <span>血量数据</span>
                        </div>
                        <div class="legend-item">
                            <div class="legend-color legend-ammo"></div>
                            <span>子弹数据</span>
                        </div>
                        <div class="legend-item">
                            <div class="legend-color legend-trap"></div>
                            <span>陷阱页</span>
                        </div>
                        <div class="legend-item">
                            <div class="legend-color legend-normal"></div>
                            <span>正常内存页</span>
                        </div>
                        <div class="legend-item">
                            <div class="legend-color legend-user"></div>
                            <span>用户数据页</span>
                        </div>
                        <div class="legend-item">
                            <div class="legend-color legend-accessed"></div>
                            <span>非法访问</span>
                        </div>
                    </div>
                    
                    <div class="memory-info">
                        <h3 class="info-title">mincore反外挂原理</h3>
                        <div class="info-content">
                            <p>mincore系统调用用于检测内存页是否驻留在物理内存中。反外挂系统利用此特性：</p>
                            <ul class="info-list">
                                <li>在关键游戏数据周围设置"陷阱页"</li>
                                <li>正常游戏流程不会访问这些页面</li>
                                <li>当外挂尝试修改游戏数据时，会访问陷阱页</li>
                                <li>mincore检测到陷阱页被访问，触发警报</li>
                            </ul>
                            <p style="margin-top: 15px;">这种技术可以有效检测内存修改类外挂，保护游戏公平性。</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <footer>
        <div class="container">
            <div class="footer-content">
                <h3>BaiYu_lidi</h3>
                <p>What can i say</p>
                
                <div class="social-icons">
                    <a href="#" class="social-icon"><i class="fab fa-github"></i></a>
                    <a href="#" class="social-icon"><i class="fab fa-twitter"></i></a>
                    <a href="#" class="social-icon"><i class="fab fa-linkedin-in"></i></a>
                    <a href="#" class="social-icon"><i class="fab fa-youtube"></i></a>
                </div>
                
                <p>&copy; 2025 反外挂技术演示 · 保留所有权利</p>
            </div>
        </div>
    </footer>
    
    <script>
        // Game state
        const gameState = {
            health: 100,
            ammo: 30,
            trapPages: [],
            userPages: [],
            normalPages: [],
            healthPage: null,
            ammoPage: null,
            cheatAccessed: false,
            lastSearchedType: null
        };
        
        // Initialize memory visualization
        function initMemoryVisualization() {
            const container = document.getElementById('memory-visualization');
            container.innerHTML = '';
            
            // Create health data block
            const healthBlock = document.createElement('div');
            healthBlock.classList.add('memory-block', 'health');
            healthBlock.style.width = '140px';
            healthBlock.style.height = '90px';
            healthBlock.style.left = '50px';
            healthBlock.style.top = '50px';
            healthBlock.innerHTML = `
                <div>玩家血量</div>
                <div>${gameState.health}</div>
            `;
            container.appendChild(healthBlock);
            gameState.healthPage = healthBlock;
            
            // Create ammo data block
            const ammoBlock = document.createElement('div');
            ammoBlock.classList.add('memory-block', 'ammo');
            ammoBlock.style.width = '140px';
            ammoBlock.style.height = '90px';
            ammoBlock.style.left = '220px';
            ammoBlock.style.top = '50px';
            ammoBlock.innerHTML = `
                <div>子弹数量</div>
                <div>${gameState.ammo}</div>
            `;
            container.appendChild(ammoBlock);
            gameState.ammoPage = ammoBlock;
            
            // Create trap pages
            const trapPositions = [
                { x: 50, y: 160, width: 100, height: 80, type: 'health', index: 1 },
                { x: 170, y: 160, width: 100, height: 80, type: 'health', index: 2 },
                { x: 290, y: 160, width: 100, height: 80, type: 'ammo', index: 3 },
                { x: 410, y: 160, width: 100, height: 80, type: 'ammo', index: 4 }
            ];
            
            gameState.trapPages = [];
            
            trapPositions.forEach((pos) => {
                const trapBlock = document.createElement('div');
                trapBlock.classList.add('memory-block', 'trap');
                trapBlock.style.width = `${pos.width}px`;
                trapBlock.style.height = `${pos.height}px`;
                trapBlock.style.left = `${pos.x}px`;
                trapBlock.style.top = `${pos.y}px`;
                trapBlock.innerHTML = `
                    <div>陷阱页 #${pos.index}</div>
                    <div style="font-size: 0.8rem;">未访问</div>
                `;
                trapBlock.dataset.type = pos.type;
                trapBlock.dataset.index = pos.index;
                trapBlock.dataset.accessed = 'false';
                container.appendChild(trapBlock);
                
                gameState.trapPages.push({
                    element: trapBlock,
                    accessed: false,
                    type: pos.type,
                    index: pos.index
                });
            });
            
            // Create normal pages
            const normalPositions = [
                { x: 50, y: 260, width: 90, height: 70, index: 1 },
                { x: 160, y: 260, width: 90, height: 70, index: 2 },
                { x: 270, y: 260, width: 90, height: 70, index: 3 },
                { x: 380, y: 260, width: 90, height: 70, index: 4 }
            ];
            
            gameState.normalPages = [];
            
            normalPositions.forEach((pos) => {
                const normalBlock = document.createElement('div');
                normalBlock.classList.add('memory-block', 'normal');
                normalBlock.style.width = `${pos.width}px`;
                normalBlock.style.height = `${pos.height}px`;
                normalBlock.style.left = `${pos.x}px`;
                normalBlock.style.top = `${pos.y}px`;
                normalBlock.innerHTML = `
                    <div>内存页 #${pos.index}</div>
                `;
                container.appendChild(normalBlock);
                
                gameState.normalPages.push({
                    element: normalBlock
                });
            });
            
            // Create user pages (1-2 for health, 3-4 for ammo)
            const userPositions = [
                { x: 50, y: 350, width: 120, height: 90, type: 'health', index: 1 },
                { x: 190, y: 350, width: 120, height: 90, type: 'health', index: 2 },
                { x: 330, y: 350, width: 120, height: 90, type: 'ammo', index: 3 },
                { x: 470, y: 350, width: 120, height: 90, type: 'ammo', index: 4 }
            ];
            
            gameState.userPages = [];
            
            userPositions.forEach((pos) => {
                const userBlock = document.createElement('div');
                userBlock.classList.add('memory-block', 'user');
                userBlock.style.width = `${pos.width}px`;
                userBlock.style.height = `${pos.height}px`;
                userBlock.style.left = `${pos.x}px`;
                userBlock.style.top = `${pos.y}px`;
                
                // Set initial value based on type
                const value = pos.type === 'health' ? gameState.health : gameState.ammo;
                userBlock.innerHTML = `
                    <div>用户数据 #${pos.index}</div>
                    <div style="font-size: 1.2rem; margin-top: 5px;">${value}</div>
                `;
                userBlock.dataset.type = pos.type;
                userBlock.dataset.index = pos.index;
                container.appendChild(userBlock);
                
                gameState.userPages.push({
                    element: userBlock,
                    type: pos.type,
                    index: pos.index
                });
            });
        }
        
        // Update game stats display
        function updateGameStats() {
            document.getElementById('health-value').textContent = gameState.health;
            document.getElementById('ammo-value').textContent = gameState.ammo;
            
            // Update memory visualization
            gameState.healthPage.innerHTML = `
                <div>玩家血量</div>
                <div>${gameState.health}</div>
            `;
            
            gameState.ammoPage.innerHTML = `
                <div>子弹数量</div>
                <div>${gameState.ammo}</div>
            `;
            
            // Update user data pages
            gameState.userPages.forEach(userPage => {
                const value = userPage.type === 'health' ? gameState.health : gameState.ammo;
                userPage.element.innerHTML = `
                    <div>用户数据 #${userPage.index}</div>
                    <div style="font-size: 1.2rem; margin-top: 5px;">${value}</div>
                `;
            });
        }
        
        // Simulate cheat access to trap pages
        function simulateCheatAccess(type) {
            gameState.cheatAccessed = true;
            
            // Access trap pages based on type
            const trapPagesToAccess = gameState.trapPages.filter(trap => trap.type === type);
            
            // Access all trap pages of the specified type
            trapPagesToAccess.forEach(trap => {
                trap.accessed = true;
                trap.element.classList.remove('trap');
                trap.element.classList.add('accessed');
                trap.element.innerHTML = `
                    <div>陷阱页 #${trap.index}</div>
                    <div style="font-size: 0.8rem; color: #ff6b6b;">非法访问!</div>
                `;
            });
        }
        
        // Run mincore detection
        function runDetection() {
            const resultPanel = document.getElementById('result-panel');
            const accessedTraps = gameState.trapPages.filter(trap => trap.accessed);
            
            if (accessedTraps.length > 0) {
                resultPanel.innerHTML = `
                    <div class="result-title">
                        <i class="fas fa-exclamation-triangle" style="color: #ff6b6b;"></i>
                        <span>检测结果</span>
                    </div>
                    <div class="result-content">
                        <p class="result-danger">发现违规用户！非法访问了陷阱内存</p>
                        <p style="margin-top: 15px;">检测到 ${accessedTraps.length} 个陷阱页被非法访问</p>
                        <p>建议操作：立即封禁该玩家账号</p>
                    </div>
                `;
            } else {
                resultPanel.innerHTML = `
                    <div class="result-title">
                        <i class="fas fa-check-circle" style="color: #41d695;"></i>
                        <span>检测结果</span>
                    </div>
                    <div class="result-content">
                        <p class="result-success">您是尊贵的绿色玩家</p>
                        <p style="margin-top: 15px;">未检测到非法内存访问行为</p>
                        <p>请继续享受游戏！</p>
                    </div>
                `;
            }
        }
        
        // Reset game state
        function resetGame() {
            gameState.health = 100;
            gameState.ammo = 30;
            gameState.cheatAccessed = false;
            gameState.lastSearchedType = null;
            
            // Reset trap pages
            gameState.trapPages.forEach(trap => {
                trap.accessed = false;
                trap.element.classList.remove('accessed');
                trap.element.classList.add('trap');
                trap.element.innerHTML = `
                    <div>陷阱页 #${trap.index}</div>
                    <div style="font-size: 0.8rem;">未访问</div>
                `;
            });
            
            updateGameStats();
            
            // Reset result panel
            document.getElementById('result-panel').innerHTML = `
                <div class="result-title">
                    <i class="fas fa-info-circle"></i>
                    <span>检测结果</span>
                </div>
                <div class="result-content">
                    点击"运行内存检测"按钮检查是否有外挂行为
                </div>
            `;
            
            // Hide search result
            document.getElementById('search-result').style.display = 'none';
        }
        
        // Search for value in memory
        function searchValue() {
            const searchValue = parseInt(document.getElementById('search-value').value);
            if (!isNaN(searchValue)) {
                // 检查是否匹配血量或子弹数
                const healthMatch = gameState.health === searchValue;
                const ammoMatch = gameState.ammo === searchValue;
                
                if (healthMatch || ammoMatch) {
                    // 匹配，触发陷阱访问
                    if (healthMatch) simulateCheatAccess('health');
                    if (ammoMatch) simulateCheatAccess('ammo');
                    
                    // 显示搜索结果
                    const resultPanel = document.getElementById('search-result');
                    const foundValue = document.getElementById('found-value');
                    
                    let foundCount = 0;
                    if (healthMatch) foundCount++;
                    if (ammoMatch) foundCount++;
                    
                    foundValue.textContent = foundCount;
                    
                    // 设置最后搜索类型
                    if (healthMatch && ammoMatch) {
                        gameState.lastSearchedType = 'both';
                    } else if (healthMatch) {
                        gameState.lastSearchedType = 'health';
                    } else if (ammoMatch) {
                        gameState.lastSearchedType = 'ammo';
                    }
                    
                    resultPanel.style.display = 'block';
                    alert(`在内存中找到 ${foundCount} 个匹配值: ${searchValue}`);
                } else {
                    // 没有匹配
                    alert(`未找到匹配值: ${searchValue}`);
                    // 隐藏搜索结果面板
                    document.getElementById('search-result').style.display = 'none';
                    gameState.lastSearchedType = null;
                }
            } else {
                alert('请输入有效的数值进行搜索');
            }
        }
        
        // Modify value in memory
        function modifyValue() {
            const modifyValue = parseInt(document.getElementById('modify-value').value);
            if (!isNaN(modifyValue)) {
                if (gameState.lastSearchedType) {
                    // 修改操作不会触发陷阱访问
                    if (gameState.lastSearchedType === 'both') {
                        gameState.health = modifyValue;
                        gameState.ammo = modifyValue;
                        alert(`成功将血量和子弹数修改为: ${modifyValue}`);
                    } else if (gameState.lastSearchedType === 'health') {
                        gameState.health = modifyValue;
                        alert(`成功将血量修改为: ${modifyValue}`);
                    } else if (gameState.lastSearchedType === 'ammo') {
                        gameState.ammo = modifyValue;
                        alert(`成功将子弹数修改为: ${modifyValue}`);
                    }
                    
                    updateGameStats();
                } else {
                    alert('请先搜索要修改的数值');
                }
            } else {
                alert('请输入有效的数值进行修改');
            }
        }
        
        // Initialize everything
        document.addEventListener('DOMContentLoaded', () => {
            initMemoryVisualization();
            updateGameStats();
            
            // Setup button events
            document.getElementById('damage-btn').addEventListener('click', () => {
                if (gameState.health > 0) {
                    gameState.health -= 10;
                    if (gameState.health < 0) gameState.health = 0;
                    updateGameStats();
                }
            });
            
            document.getElementById('shoot-btn').addEventListener('click', () => {
                if (gameState.ammo > 0) {
                    gameState.ammo -= 1;
                    updateGameStats();
                }
            });
            
            document.getElementById('reset-btn').addEventListener('click', resetGame);
            
            document.getElementById('search-btn').addEventListener('click', searchValue);
            
            document.getElementById('modify-btn').addEventListener('click', modifyValue);
            
            document.getElementById('detect-btn').addEventListener('click', runDetection);
        });
    </script>
</body>
</html>